package org.myontology.helpers;

import org.openrdf.model.URI;

public class TypedURI implements URI {

	private URI uri;

	public TypedURI(URI uri) {
		this.uri=uri;
	}

	public String getLocalName() {
		return uri.getLocalName();
	}

	public String getNamespace() {
		return uri.getNamespace();
	}

	public String stringValue() {
		return uri.stringValue();
	}
	
	public String getType() {
		String u = stringValue();
		u=cutLast(u);
		u=u.substring(u.lastIndexOf('/')+1);
		return u;
	}
	
	
	public String getVersion() {
		String u = stringValue();
		u=cutLast(u);
		u=cutLast(u);
		u=u.substring(u.lastIndexOf('/')+1);
		return u;
	}
	
	private String cutLast(String s) {
		return s.substring(0,s.lastIndexOf('/'));
	}

}
